.section .text
.global _entry
_entry:
        #设置栈指针
        la sp, stack0
        li a0, 1024*4
        add sp, sp, a0

        # 清零BSS段（如果需要）
        call clear_bss

        #调用主函数
        call main
spin:
        j spin

.global clear_bss
clear_bss:
        la a0, sbss
        la a1, ebss
        bgeu a0, a1, clear_bss_done
clear_bss_loop:
        sd zero, (a0)
        addi a0, a0, 8
        bltu a0, a1, clear_bss_loop
clear_bss_done:
        ret